//
//  TargetType.swift
//  XYNetwork
//
//  Created by lxy on 2021/1/29.
//

import Foundation

public enum XYMethod: String {
    case get
    case post
}

/// The protocol used to define the specifications necessary for a `MoyaProvider`.
public protocol TargetType {
    
    /// The target's base `URL`.
    var baseURL: URL { get }
    
    /// The path to be appended to `baseURL` to form the full `URL`.
    var path: String { get }
    
    /// The HTTP method used in the request.
    var method: XYMethod { get }
    
    /// The headers to be used in the request.
    var headers: [String: String]? { get }
}

public extension TargetType {
    var headers: [String: String]? { return nil }
}
